﻿/*************************************************************************
 * Created by OhZee Creative, LLC
 * 2013
 * This code is licensed under Microsoft Public License (Ms-PL)
 * http://opensource.org/licenses/ms-pl
 * http://ozframework.codeplex.com/
 *************************************************************************/

namespace OhZeeCreative.WindowsPhone.Helpers
{
    using Microsoft.Phone.Tasks;
    using System;

    public static class TasksHelper
    {
        public static void SearchStore(string searchTerms, MarketplaceContentType type = MarketplaceContentType.Applications)
        {
            MarketplaceSearchTask marketSearch = new MarketplaceSearchTask();
            marketSearch.ContentType = type;
            marketSearch.SearchTerms = searchTerms;
            marketSearch.Show();
        }

        public static void Email(string toEmail, string subject, string body = null, string ccEmail = null, string bccEmail = null)
        {
            EmailComposeTask task = new EmailComposeTask();
            task.To = toEmail;
            task.Subject = subject;
            task.Body = body;
            task.Cc = ccEmail;
            task.Bcc = bccEmail;
            task.Show();
        }

        public static void Share(string appName, string message, Uri deepLink)
        {
            ShareLinkTask linkTask = new ShareLinkTask();
            linkTask.Title = appName;
            linkTask.Message = message;
            linkTask.LinkUri = deepLink;
            linkTask.Show();
        }

        public static void ReviewApp()
        {
            MarketplaceReviewTask task = new MarketplaceReviewTask();
            task.Show();
        }

        public static void LaunchWebPage(string absolutePath)
        {
            WebBrowserTask task = new WebBrowserTask();
            task.Uri = new Uri(absolutePath, UriKind.Absolute);
            task.Show();
        }
    }
}
